package cn.xawl.gulimall.product.entity;

import cn.xawl.common.valid.StatusValue;
import cn.xawl.common.valid.group.SaveGroup;
import cn.xawl.common.valid.group.UpdateGroup;
import cn.xawl.common.valid.group.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;


/**
 * 品牌
 * 
 * @author lh
 * @email lhm49869999@163.com
 * @date 2020-06-17 13:44:59
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@Null(groups = SaveGroup.class)  //添加数据时不能携带id字段
	@NotNull(groups = UpdateGroup.class) //修改数据时必须携带id字段
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotEmpty(groups = {SaveGroup.class})
	@URL(groups = {SaveGroup.class, UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@StatusValue(values = {0, 1}, groups = {UpdateStatusGroup.class, SaveGroup.class, UpdateGroup.class})
	@NotNull(groups = {SaveGroup.class, UpdateStatusGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotNull(groups = SaveGroup.class)
	@Pattern(regexp = "^[a-zA-Z]$", message = "必须是一个字母", groups = {SaveGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(groups = SaveGroup.class)
	@Min(value = 0, message = "必须是一个正整数", groups = {SaveGroup.class, UpdateGroup.class})
	private Integer sort;

}
